<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        .div1 {
            position: absolute;
            top: 20px;
            left: 20px;
            width: 20%;
            height: 300px;
            background: linear-gradient(to left, #f00, #f00) left top no-repeat,
            linear-gradient(to bottom, #f00, #f00) left top no-repeat,
            linear-gradient(to left, #f00, #f00) right top no-repeat,
            linear-gradient(to bottom, #f00, #f00) right top no-repeat,
            linear-gradient(to left, #f00, #f00) left bottom no-repeat,
            linear-gradient(to bottom, #f00, #f00) left bottom no-repeat,
            linear-gradient(to left, #f00, #f00) right bottom no-repeat,
            linear-gradient(to left, #f00, #f00) right bottom no-repeat;
            background-size: 1px 20px, 20px 1px, 1px 20px, 20px 1px;
        }

        .div2 {
            border: 1px red solid;
            position: absolute;
            top: 20px;
            left: 400px;
            width: 20%;
            height: 300px;
            background: linear-gradient(to left, #f00, #f00) left top no-repeat,
            linear-gradient(to bottom, #f00, #f00) left top no-repeat,
            linear-gradient(to left, #f00, #f00) right top no-repeat,
            linear-gradient(to bottom, #f00, #f00) right top no-repeat,
            linear-gradient(to left, #f00, #f00) left bottom no-repeat,
            linear-gradient(to bottom, #f00, #f00) left bottom no-repeat,
            linear-gradient(to left, #f00, #f00) right bottom no-repeat,
            linear-gradient(to left, #f00, #f00) right bottom no-repeat;
            background-size: 2px 20px, 20px 2px, 2px 20px, 20px 2px;
        }

    </style>
</head>
<body>
<div class="div1">

</div>
<div class="div2">

</div>
</body>
</html>